#ifndef _ML_REGRESS_LINEAR_H_
#define _ML_REGRESS_LINEAR_H_
#include "MLDataSet.h"
#include "MLDataPoint.h"
_MYLABLIB_BEGIN

class CMLRegress_Linear
{
public:
	// Constructor and Destructor
	CMLRegress_Linear(void);
	~CMLRegress_Linear(void);

public:
	// Methods

	/** 
	@Name: MultiVariant linear regress function
	@Desc:
	    Suppose the linear regression model is : Y = AX
		Y is the data points of the last element of the input parameter 'dataSets'
		X is the data points of other elements( except the last) of 'dataSets'.
		A is Output parameter 'coefficients'. The vector of coefficients is make of every dimension's coefficients
	*/
	static int MultiVariantRegress(int nDimension, const std::vector<CMLDataSet>& dataSets, std::vector<CMLDataPoint>& coefficients);
	
	/** 
	@Name: AutoRegress function
	@Desc:
	    Suppose the AutoRegress model is : X(t) = A(1)X(t-1) + A(2)X(t-2) + ... + A(p-1)X(t-(p-1)) + A(p)
		X(1), X(2), ... , X(n) is the input parameter 'dataSet'
		p is the size of autoregress parameters;
		(A(1),...,A(p)) is Output parameter 'coefficients'. The vector of coefficients is make of every dimension's coefficients
	*/
	static int AR_Regress(int nDimension, const CMLDataSet& dataSet, int p, std::vector<CMLDataPoint>& coefficients, CMLDataPoint& chisqs);

	static int AR_Regress(int nDimension, const CMLDataSet& dataSet, int p, std::vector<CMLDataPoint>& coefficients)
	{
		CMLDataPoint temp;
		return AR_Regress(nDimension, dataSet, p, coefficients, temp);
	}

	static int AR_Predict(int nDimension, CMLDataSet& predicts, int p, std::vector<CMLDataPoint>& coefficients, int nPredictLen);

private:
	// Fields

};
_MYLABLIB_END

#endif
